package day2test1;

import java.io.Serializable;

//1,通过system. out提示信息,采用scanner录入学生信息,保存至集合。
//2,查看全部学生信息。
//3,按学生姓名查询该学生信息。
//4,创建学生类,记录保存至集合。
//5添加专业,按专业查询学生信息
public class Student implements Comparable,Serializable{
	
/**
	 * 
	 */ 
private static final long serialVersionUID = 1L;
private int id ;//编号
private String name; //姓名
private int age;//年龄
private String sex; //性别
private String classGrade;//班级
private String major;//专业类；

public Student() {
	// TODO Auto-generated constructor stub
}
public int getId() {
	return id;
}
public void setId(int id) {
	this.id = id;
}
public String getName() {
	return name;
}
public void setName(String name) {
	this.name = name;
}
public int getAge() {
	return age;
}
public void setAge(int age) {
	this.age = age;
}
public String getSex() {
	return sex;
}
public void setSex(String sex) {
	this.sex = sex;
}
public String getClass_grade() {
	return classGrade;
}
public void setClass_grade(String class_grade) {
	this.classGrade = class_grade;
}
public String getMajor() {
	return major;
}
public void setMajor(String major) {
	this.major = major;
}
@Override
public String toString() {
	return " [学号=" + id + ", 姓名=" + name + ", 年龄=" + age + ", 性别=" + sex + ", 班级=" + classGrade
			+ "]";
}
public Student(int id, String name, int age, String sex, String class_grade,String major) {
	super();
	this.id = id;
	this.name = name;
	this.age = age;
	this.sex = sex;
	this.classGrade = class_grade;
	this.major = major;
}
@Override
public int compareTo(Object o) {
	// TODO Auto-generated method stub
	Student student = (Student) o;
	int flag = (int)(this.getId()-student.getId());
	return flag;
}



	
}
